package com.naiterui.ehp.bs.agent.vo;

import java.util.Date;

import com.naiterui.ehp.bs.agent.entity.AgAgent;

import com.naiterui.ehp.bs.agent.util.ImgPathUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

/**
 * @author yiren
 * @since 2022/2/15
 */
@Data
@Builder
public class UserVO {
	@ApiModelProperty(value = "经纪人ID")
	private Long agentId;

	@ApiModelProperty(value = "token")
	private String token;

	@ApiModelProperty(value = "用户状态(0:未认证, 1:待审核, 2:已认证, 3:已离职)")
	private Integer status;

	@ApiModelProperty(value = "是否新注册用户(0:否, 1:是)")
	private Integer newRegister;

	@ApiModelProperty(value = "头像地址")
	private String headUrl;

    @ApiModelProperty(value = "加入时间")
    private Date entryTime;

	@ApiModelProperty(value = "websocket连接Host，完整连接方式为：wss://{websocketHost}/{userId}/{token}")
	private String websocketHost;

	@ApiModelProperty("websocket心跳间隔，毫秒")
	private Long heartBeatRate;

	@ApiModelProperty("websocket心跳信号")
	private String heartBeatSignal;

	public static UserVO of(AgAgent agAgent){
		return UserVO.builder().agentId(agAgent.getId()).token(agAgent.getToken())
            .headUrl(ImgPathUtil.pathToUrl(agAgent.getHeadUrl())).status(agAgent.getStatus()).entryTime(agAgent.getEntryTime()).build();
	}

}
